import React, {Component} from 'react';
import {Route} from 'react-router-dom';
import Loadable from 'react-loadable';
import load, {Loading} from 'components/Loading';
import fetcher from 'common/fetcher';


const ROLE_MANAGE = `/role/management`;
const LoadableRoleManage = Loadable.Map({
    loader: {
        RoleManage: () => import(/* webpackChunkName: "src/uic/role/RoleManage" */'./RoleManage'),
        roleData: () => fetcher('/role'),
    },
    loading: Loading,
    render: (l, props) => {
        const RoleManage = l.RoleManage.default,
            roleData = l.roleData;
        return <RoleManage {...props} data={roleData} />;
    },
});

export default [
    <Route key={ROLE_MANAGE} path={ROLE_MANAGE} component={LoadableRoleManage} />,
];
